package org.sky.springbootdocker.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@Api(tags = "hi")
public class HiController {

    @GetMapping(value = "/hi")
    @ApiOperation(value = "hi")
    public String hi(@RequestParam(value = "name", defaultValue = "SpringBoot-Docker", required = false) String name, HttpServletRequest request) {
        String idAddress = request.getHeader("real_ip");
        return "<h6>Hi," + name + ",You Ip Adress is " + idAddress + " This is SpringBoot Docker Build Test Center!<h6>";
    }
}
